<template>
  <div style="min-height: 300px">
    <a-form :model="entity" :rules="rules" label-width="120px">
      <a-form-item label="计划名称" field="title">
        <a-input v-model="entity.title"  />
      </a-form-item>
      <a-form-item label="计划开工时间" field="begindate">
        <a-input   />
      </a-form-item>
      <a-form-item label="计划完工时间" field="enddate">
        <a-input   />
      </a-form-item>
      <a-form-item label="备注" field="remark">
        <a-textarea v-model="entity.remark"  ></a-textarea>
      </a-form-item>
    </a-form>

    <h4 style="color: #f60000">这里显示未完工的生产任务通知单行明细，行明显有工艺路线，列出后，根据工艺路线选择工序</h4>
    <a-table :bordered="{cell:true}" :pagination="false" stripe :data="entity.planList">
      <template #columns>
        <a-table-column title="贸易号" data-index="myh"></a-table-column>
        <a-table-column title="任务通知单号" data-index="taskno"></a-table-column>
        <a-table-column title="料品名称" data-index="lpmc"></a-table-column>
        <a-table-column title="产品标识号" data-index="cpm"></a-table-column>
        <a-table-column title="生产重量" data-index="sczl"></a-table-column>
        <a-table-column title="选择工序" width="350">
          <template #cell="{ record }">
            <a-checkbox-group :default-value="['1']">
              <a-checkbox value="1">下料</a-checkbox>
              <a-checkbox value="2">加热</a-checkbox>
              <a-checkbox value="3">精锻</a-checkbox>
              <a-checkbox value="4">热处理</a-checkbox>
              <a-checkbox value="5">磨皮</a-checkbox>
              <a-checkbox value="6">机加工</a-checkbox>
            </a-checkbox-group>
          </template>
        </a-table-column>
      </template>
    </a-table>

    <h4 style="color: #f60000">预派工单，只有计划下发，派工单才会生效被看到，被报工</h4>
    <h4 style="color: #f60000">上面的表格中，每行选择一个工具都会生产一个单据</h4>
    <a-row gutter="10">
      <a-col span="8">
        <a-card>
          <p>贸易号:贸2025-001</p>
          <p>料品名:H13</p>
          <p>产品标识号:H13-250011</p>
          <p>工序:下料</p>
          <p>备注：
            <a-textarea  ></a-textarea>
          </p>
          <p>
            附件上传：
          </p>
        </a-card>
      </a-col>
      <a-col span="8">
        <a-card>
          <p>贸易号:贸2025-002</p>
          <p>料品名:H15</p>
          <p>产品标识号:H15-250015</p>
          <p>工序:下料</p>
          <p>备注：
            <a-textarea  ></a-textarea>
          </p>
          <p>
            附件上传：
          </p>
        </a-card>
      </a-col>
    </a-row>
  </div>
</template>

<script lang="ts" setup>
import {reactive, ref, onMounted, defineProps, defineEmits, nextTick} from "vue";

const emit = defineEmits(['update:modelValue'])
let props = defineProps({
  modelValue : {type : Boolean, default: true},
  entityId : {type : Number, default: 0}
})

let entity = ref({
  id : props.entityId,
  title:'',
  remark:'',
  planList : [
    {id : 1,myh:'贸2025-001',  taskno : '2025-BC-0001',lpmc:'H13', cpm:'H13-250011', sczl:'25.2T'},
    {id : 2,myh:'贸2025-002',  taskno : '2025-BC-0001',lpmc:'H15', cpm:'H15-250015', sczl:'15.3T'},
  ],
  pgdList : [
    {id : 1,myh:'贸2025-001',  taskno : '2025-BC-0001',lpmc:'H13', cpm:'H13-250011', sczl:'25.2T', gxname:'下料'},
    {id : 2,myh:'贸2025-002',  taskno : '2025-BC-0001',lpmc:'H15', cpm:'H15-250015', sczl:'15.3T', gxname:'下料'},
  ]
})
const rules = reactive({
  title: [
    { required: true, message: '请输入计划名称', trigger: 'blur' },
  ],
})
onMounted(()=>{
  nextTick(()=>{
  })
})
</script>

<style scoped>

</style>
